package cn.tedu.property_management_system.utils.linstener;

import cn.tedu.property_management_system.entity.Complaint;
import cn.tedu.property_management_system.service.IComplaintService;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
@Slf4j
public class ComplaintUploadListener extends AnalysisEventListener<Complaint> {

    @Autowired
    IComplaintService complaintService;

    @Override
    public void invoke(Complaint complaint, AnalysisContext analysisContext) {
        complaintService.bathUpDate(complaint);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.debug("上传完成");
    }
}
